#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    pushbuton = new QPushButton(ui->centralwidget);
    pushbuton->setGeometry(QRect(255,180,233,122));
    pushbuton->setText("aaaaaaa");
    pt = new mytset;

        connect(pushbuton , SIGNAL(clicked(bool)),this , SLOT(aaaaa(bool))); //第一种方式
        //connect(pushbuton ,&QPushButton::clicked,this,&MainWindow::aaaaa);    //第二种方式
        connect(pushbuton , &QPushButton::clicked , this ,[](){qDebug()<<"自定义信号槽"<<endl;}); //使用lambda表达式

        connect(pt, SIGNAL(sss(int)), this ,SLOT(qqq(int)));

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::aaaaa(bool checked)
{
    qDebug()<<"自定义槽信号"<<checked<<endl;
    pushbuton->setText("name");
    pt->sss(100);

}

void MainWindow::qqq(int x)
{
    qDebug()<<"收到sss的信号"<<x<<endl;

}




void MainWindow::on_pushButton_clicked()
{
    qDebug()<<"anniu"<<endl;
}
